import { createHashRouter } from "react-router";
import Home from "./views/Home";
import App from "./App";
import Layout from "./Layout";
import { lazy } from "react";
import ErrorPage from "./views/ErrorPage";

// 自定义路由map  hash模式
const routes = createHashRouter([
  {
    path: "/",
    Component: App,
    children: [
      {
        path: "/",
        Component: Layout,
        children: [
          {
            index: true,
            Component: Home,
          },
          {
            path: "manager",
            Component: lazy(() => import("./views/Manager")),
          },
          {
            path: "analyze",
            Component: lazy(() => import("./views/Analyze")),
          },
          {
            path: "market",
            Component: lazy(() => import("./views/Market")),
          },
        ],
      },
      {
        path: "viplist",
        Component: lazy(() => import("./views/VipUserList")),
      },
      {
        path: "vipbirthlist",
        Component: lazy(() => import("./views/VipBirthdayList")),
      },
      {
        path: "filter",
        Component: lazy(() => import("./views/FilterView")),
      },
      {
        path: "vipdetail/:id",
        Component: lazy(() => import("./views/VipDetail")),
      },
      {
        path: "conpon",
        Component: lazy(() => import("./views/ConponView")),
      },
      {
        path: "*",
        Component: ErrorPage,
      },
    ],
  },
]);
export default routes;
